package com.swotxu.oldwebproject.session.listener.session;

import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import java.lang.reflect.Method;

/**
 * redis session事件状态对象
 * 通知 HttpSessionMethodListener 的信号载体
 *
 * @Date: 2020/1/15 15:19
 * @Author: xu.hai
 */
public class RedisSessionEvent extends HttpSessionEvent {
    // 代理session对象
    private Object proxy;
    // 执行方法
    private Method method;
    // 执行方法所需参数
    private Object[] args;
    // 执行方法返回的结果值
    private Object result;
    // 中断状态
    private boolean interrupte;

    public RedisSessionEvent(HttpSession source) {
        super(source);
    }

    public RedisSessionEvent(HttpSession source,Object proxy, Method method, Object[] args) {
        this(source, proxy, method, args, null);
    }
    /**
     * 初始化 redissession事件源
     * @param source    原RedisSession对象
     * @param proxy     代理session对象
     * @param method    执行方法
     * @param args      执行方法所需参数
     * @param result    执行方法返回的结果值
     */
    public RedisSessionEvent(HttpSession source,Object proxy, Method method, Object[] args,Object result) {
        super(source);
        this.proxy = proxy;
        this.method = method;
        this.args = args;
        this.result = result;
    }

    public Object getProxy() {
        return proxy;
    }

    public Method getMethod() {
        return method;
    }

    public Object[] getArgs() {
        return args;
    }

    public Object getResult() {
        return result;
    }

    public void setResult(Object result) {
        this.result = result;
    }

    public boolean isInterrupte() {
        return interrupte;
    }

    public void setInterrupte(boolean interrupte) {
        this.interrupte = interrupte;
    }
}
